package com.ztgf.search.models.service;


import com.ztgf.common.constant.Result;
import com.ztgf.search.models.bean.SearchRequestBean;
import com.ztgf.search.models.bean.SearchResponseBean;
import com.ztgf.search.models.dto.EsGoodsDTO;

import java.util.List;

/**
 * 搜索引擎服务类
 *
 * @author weiyuan
 * @version 1.0
 */
public interface SearchService {
    /**
     * 搜索商品
     *
     * @param aliasName
     * @param type
     * @param searchFields
     * @param searchRequestBean
     * @return
     */
    SearchResponseBean searchGoods(String aliasName, String type, String searchFields, SearchRequestBean searchRequestBean);


    /**
     * 搜索商品
     *
     * @param aliasName
     * @param type
     * @param searchFields
     * @param searchRequestBean
     * @return
     */
    SearchResponseBean searchBrand(String aliasName, String type, String searchFields, SearchRequestBean searchRequestBean);

    /**
     * @Description: 添加数据到es
     * @Author: chenyu.wang
     * @Params: []
     * @Date: 2020.11.18 09:42
     */
    Result add();

    /**
     * @Description: 添加单个商品
     * @Author: chenyu.wang
     * @Params: [aliasName, typeName, begin, end, totalList]
     * @Date: 2020.11.18 11:44
     */
    void addGoods(String aliasName, String typeName, int begin, int end, List<EsGoodsDTO> totalList);

    /**
     * @Description: 删除数据
     * @Author: chenyu.wang
     * @Params: [aliasName, typeName, id]
     * @Date: 2020.11.18 14:02
     */
    void deleteData(String aliasName, String typeName, String id);

    /**
     * @Description: 判断商品索引是否存在
     * @Author: chenyu.wang
     * @Params: [idexName]
     * @Date: 2020.11.18 14:20
     */
    boolean checkIndex(String indexName);

    /**
     * @Description: 判断商品索引是否存在
     * @Author: chenyu.wang
     * @Params: [idexName]
     * @Date: 2020.11.18 14:20
     */
    boolean checkIndexByIndexName(String indexName);

    /**
     * @return : boolean
     * @Author :chenyu.wang
     * @Description : 添加映射和添加数据
     * @Date : 2021.03.30 09:20
     * @Param : [indexName:索引名称,type:1商品，2店铺]
     **/
    boolean addMappingAndAddDate(String indexName,Integer type);


}
